package com.erp.mclass

import android.content.SharedPreferences
import com.erp.util.JsonUtil
import com.erp.util.Myutil
import org.json.JSONObject

/**
 * Created by Administrator on 2018/4/11/011.
 * 作者：刘洋
 */
class QuanXian {
    companion object {
        /**
         * 是否拥有查看crm的权限
         */
         var iscrm: Boolean = false
        /**
         * 是否拥有查询订单的权限
         */
         var isscdd: Boolean = false
        /**
         * 是否拥有查看公告的权限
         */
         var isgonggao: Boolean = false
        /**
         * 是否有上传发货单据的权限
         */
        var isdeliver: Boolean = false
        /**
         * 是否有上传发货单据的权限
         */
         var isdanju: Boolean = false
        /**
         * 是否有删除发货单据的权限
         */
         var isdeletedanju: Boolean = false
        /**
         * 是否有查看发货单据列表的权限
         */
         var ischakandanju: Boolean = false
        /**
         * 计件权限
         */
         var isjijian: Boolean = false
        /**
         * 查看质量问题权限
         */
         var isviewquality: Boolean = false
        /**
         * 查看订单图片权限
         */
         var isvieworder: Boolean = false
        /**
         * 上传质量问题权限
         */
         var iseditquality: Boolean = false
        /**
         * 上传订单图片权限
         */
         var iseditorder: Boolean = false
        /**
         * c查看节号权限
         */
         var ischakanjiehao: Boolean = false
        /**
         * 分配节号权限
         */
         var isfenpeijiehao: Boolean = false
        /**
         * 分配所有节号
         */
         var isfenpeisuoyoujiehao: Boolean = false
        /**
         * 取消分配节号
         */
         var isquxiaofenpeijiehao: Boolean = false
        /**
         * 取消分配节号
         */
        var isdeletefenpeijiehao: Boolean = false
        /**
         * 查看节号全名
         */
         var isquanmingjiehao: Boolean = false
        /**
         * 查看纸箱分配
         */
         var isChaKanZhiXiangFenPei: Boolean = false
        /**
         * 编辑纸箱分配
         */
         var isBianJiZhiXiang: Boolean = false
        /**
         * 分配纸箱权限
         */
         var isFenPeiZhiXiang: Boolean = false
        /**
         * 分配所有纸箱号
         */
         var isFenPeiSuoYouZhiXiang: Boolean = false
        /**
         * 取消分配纸箱
         */
         var isQuXiaoFenPeiZhiXiang: Boolean = false
        /**
         * 安装指南权限
         */
         var isAnZhuangZhiNan: Boolean = false
        /**
         * 设计指南权限
         */
         var isSheJiZhiNan: Boolean = false
        /**
         * 上传安装图片权限
         */
         var isShuangChuanAnZhuang: Boolean = false
        /**
         * 新开专卖店权限
         */
         var isXingKaiZhuanMaiDian: Boolean = false
        /**编辑专卖店图片权限 */
         var isBianJiZhuanMaiDian: Boolean = false
        /**查看物料质量问题权限 */
         var isChaKanWuLiaoZhiLiang: Boolean = false
        /**修改物料质量问题权限 */
         var isXiuGaiWuLiaoZhiLiang: Boolean = false
        /**删除物料质量问题权限 */
         var isDeleteWuLiaoZhiLiang: Boolean = false
        /**修改质量处理和解决方案权限 */
         var isXiuGaiWuLiaoZhiLiangT: Boolean = false
        /**查看投诉建议权限 */
         var isChaKanTouSuJianYi: Boolean = false
        /**查看投诉建议权限 */
         var isChaKanAllTouSuJianYi: Boolean = false
        /**修改投诉建议权限 */
         var isXiuGaiTouSuJianYi: Boolean = false
        /**修改投诉建议责任人权限 */
        var isXiuGaiTouSuTudy: Boolean = false
        /**回复投诉建议*/
        var isreplyTouSuJianYi :  Boolean = false
        /**计件采集权限 */
         var isJiJianCaiJi: Boolean = false
        /**录入计件采集权限 */
         var isLvRuJiJianCaiJi: Boolean = false
        /**专卖店考试权限 */
         var isZhuanMaiDianKaoShi: Boolean = false
        /**生产中心考试权限 */
         var isShengChanZhongXingKaoShi: Boolean = false
        /**营销中心考试权限 */
         var isYingXiaoZhongXingKaoShi: Boolean = false
        /**查看材料质量权限*/
         var isChaKanCaiLiaoZhiLiang : Boolean =false
        /**修改材料质量权限*/
         var isXiuGaiCaiLiaoZhiLiang : Boolean =false
        /**删除材料质量权限*/
         var  isShanChuCaiLiaoZhiLiang : Boolean =false
        /**查看家纺出入仓单*/
        var isChakanJiaFang : Boolean = false
        /**编辑家纺出入仓单*/
        var isEditJiaFang : Boolean = false
        /**编辑别人家纺出入仓单*/
        var isEditAllJiaFang : Boolean = false
        /**审核家纺出入仓单*/
        var isAuditJiaFang :  Boolean = false
        /**查看分板纸箱*/
        var isViewBoardCartonDistribution :  Boolean = false
        /**分配纸箱权限*/
        var isEditBoardCartonDistribution: Boolean = false
        /**分配所有分板纸箱*/
        var isEditAllBoardCartonDistribution :  Boolean = false
        /**取消分配分板纸箱*/
        var isCancelBoardCartonDistribution :  Boolean = false
        /**查看拼装包装计件采集*/
        var isViewPackPiece : Boolean = false
        /**修改拼装包装计件采集*/
        var isEditPackPiece : Boolean = false
        /**查看卡诺亚资料*/
        var isViewArticle : Boolean = false
        /**查看精细化管理资料*/
        var isViewElaborateManagement : Boolean = false
        /**修改精细化管理资料*/
        var isEditElaborateManagement : Boolean = false
        /**查看制程检验权限*/
        var isViewProcessInspection : Boolean = false
        /**取消制程检验权限*/
        var isEditProcessInspection : Boolean = false
        /**取消制程检验权限*/
        var isCancelProcessInspection : Boolean = false
        /**取消制程检验权限*/ 
        var isEditProjectOrderProcess : Boolean = false
        /**BD图扫码查看权限*/
        var isManufacturingInformation : Boolean = false
        /**上料调度执行台*/
        var isProductionDispatchExecute : Boolean = false
        /**上料调度收料台*/
        var isProductionDispatchAccomplish : Boolean = false
        /**查看对账照片*/
        var isViewStatementAccountPhoto : Boolean = false
        /**修改对账照片*/
        var isEditStatementAccountPhoto : Boolean = false
        /**查看代加工*/
        var isViewOemOrder : Boolean = false
        /**修改代加工*/
        var isEditViewOemOrder : Boolean = false
        /**修改代加工*/
        var isPrintYuliaoLabel : Boolean = false
        /**查看余料仓位*/
        var isViewYuliaoFreightSpace : Boolean = false
        /**修改余料仓位*/
        var isEditYuliaoFreightSpace : Boolean = false
        /**查看余料仓位余料*/
        var isViewYuliaoFreightSpaceGi : Boolean = false
        /**余料仓位余料出仓入仓*/
        var isEditYuliaoFreightSpaceGi : Boolean = false
        /**板材质量*/
        var isConsigneeMaterialQuality : Boolean = false
        /**节号采集*/
        var isGatherPieceworkColl : Boolean = false
        /**创建pmc包条码并打印*/
        var isPmcPcode : Boolean = false
        /**查看pmc堆号*/
        var isPMCDuiHao : Boolean = false
        /**领料申请单合包*/
        var isCreateStoresRequisition : Boolean = false
    }
    fun geuQuanXian(jo : JSONObject){
        Myutil.longlogshow("geuQuanXian",jo.toString())
        iscrm = JsonUtil.getisvolue(jo, "view crm_order")
        isscdd = JsonUtil.getisvolue(jo, "view scdd list")
        isgonggao = JsonUtil.getisvolue(jo, "erp_notice_board view notice board list")
        isdanju = JsonUtil.getisvolue(jo, "upload deliver voucher")
        isdeletedanju = JsonUtil.getisvolue(jo, "delete deliver voucher")
        ischakandanju = JsonUtil.getisvolue(jo, "view deliver voucher")
        isjijian = JsonUtil.getisvolue(jo, "view piecework list")
        isvieworder = JsonUtil.getisvolue(jo, "view order content pictures")
        isviewquality = JsonUtil.getisvolue(jo, "view quality issues pictures")
        iseditquality = JsonUtil.getisvolue(jo, "edit quality issues pictures")
        iseditorder = JsonUtil.getisvolue(jo, "edit order content pictures")
        ischakanjiehao = JsonUtil.getisvolue(jo, "view batch distribution")
        isfenpeijiehao = JsonUtil.getisvolue(jo, "edit batch distribution")
        isfenpeisuoyoujiehao = JsonUtil.getisvolue(jo, "edit all batch distribution")
        isquxiaofenpeijiehao = JsonUtil.getisvolue(jo, "cancel batch distribution")
        isquanmingjiehao = JsonUtil.getisvolue(jo, "batch_distribution view all part of batch name")
        isChaKanZhiXiangFenPei = JsonUtil.getisvolue(jo, "view carton distribution")
        isBianJiZhiXiang = JsonUtil.getisvolue(jo, "upload carton distribution")
        isFenPeiZhiXiang = JsonUtil.getisvolue(jo, "edit carton distribution")
        isFenPeiSuoYouZhiXiang = JsonUtil.getisvolue(jo, "edit all carton distribution")
        isQuXiaoFenPeiZhiXiang = JsonUtil.getisvolue(jo, "cancel carton distribution")
        isAnZhuangZhiNan = JsonUtil.getisvolue(jo, "knydata installer_guide overview allow")
        isSheJiZhiNan = JsonUtil.getisvolue(jo, "knydata designer_guide overview allow")
        isShuangChuanAnZhuang = JsonUtil.getisvolue(jo, "installer_pic")
        isXingKaiZhuanMaiDian = JsonUtil.getisvolue(jo, "erp_user view users list")
        isBianJiZhuanMaiDian = JsonUtil.getisvolue(jo, "erp_user edit exclusive_shop fuwu anzhuang")
        isChaKanWuLiaoZhiLiang = JsonUtil.getisvolue(jo, "view material_quality")
        isXiuGaiWuLiaoZhiLiang = JsonUtil.getisvolue(jo, "edit material_quality")
        isDeleteWuLiaoZhiLiang = JsonUtil.getisvolue(jo, "delete material_quality")
        isXiuGaiWuLiaoZhiLiangT = JsonUtil.getisvolue(jo, "edit-manager material_quality")
        isChaKanTouSuJianYi = JsonUtil.getisvolue(jo, "view complaint_suggestion")
        isXiuGaiTouSuJianYi = JsonUtil.getisvolue(jo, "edit complaint_suggestion")
        isXiuGaiTouSuTudy = JsonUtil.getisvolue(jo,"edit duty complaint_suggestion")
        isJiJianCaiJi = JsonUtil.getisvolue(jo, "view piecework_gather list")
        isLvRuJiJianCaiJi = JsonUtil.getisvolue(jo, "set piecework_gather")
        isZhuanMaiDianKaoShi = JsonUtil.getisvolue(jo, "txydt dati")
        isShengChanZhongXingKaoShi = JsonUtil.getisvolue(jo, "zstk dati")
        isYingXiaoZhongXingKaoShi = JsonUtil.getisvolue(jo, "yxzxtk dati")
        isChaKanCaiLiaoZhiLiang = JsonUtil.getisjo(jo,"view supply_quality")
        isXiuGaiCaiLiaoZhiLiang = JsonUtil.getisjo(jo,"edit supply_quality")
        isShanChuCaiLiaoZhiLiang = JsonUtil.getisjo(jo,"delete supply_quality")
        isChakanJiaFang = JsonUtil.getisjo(jo,"view inventory ioorder")
        isEditJiaFang = JsonUtil.getisjo(jo,"edit inventory ioorder")
        isEditAllJiaFang= JsonUtil.getisjo(jo,"edit inventory ioorder all")
        isAuditJiaFang= JsonUtil.getisjo(jo,"audit inventory ioorder")
        isViewBoardCartonDistribution= JsonUtil.getisjo(jo,"view board carton distribution")
        isEditBoardCartonDistribution= JsonUtil.getisjo(jo,"edit board carton distribution")
        isEditAllBoardCartonDistribution= JsonUtil.getisjo(jo,"edit all board carton distribution")
        isCancelBoardCartonDistribution= JsonUtil.getisjo(jo,"cancel board carton distribution")
        isreplyTouSuJianYi= JsonUtil.getisjo(jo,"edit reply complaint_suggestion")
        isChaKanAllTouSuJianYi= JsonUtil.getisjo(jo,"view all complaint_suggestion")
        isViewPackPiece= JsonUtil.getisjo(jo,"view pack_piece")
        isEditPackPiece= JsonUtil.getisjo(jo,"edit pack_piece")
        isViewArticle= JsonUtil.getisjo(jo,"knydata overview allow")
        isViewElaborateManagement = JsonUtil.getisjo(jo,"view elaborate_management")
        isEditElaborateManagement = JsonUtil.getisjo(jo,"edit elaborate_management")
        isdeletefenpeijiehao = JsonUtil.getisjo(jo,"delete batch distribution")
        isViewProcessInspection = JsonUtil.getisjo(jo,"view process_inspection")
        isEditProcessInspection = JsonUtil.getisjo(jo,"edit process_inspection")
        isCancelProcessInspection = JsonUtil.getisjo(jo,"cancel process_inspection")
        isEditProjectOrderProcess = JsonUtil.getisjo(jo,"edit project_order_process")
        isManufacturingInformation = JsonUtil.getisjo(jo,"manufacturing_information")
        isProductionDispatchExecute = JsonUtil.getisjo(jo,"production_dispatch_execute")
        isProductionDispatchAccomplish = JsonUtil.getisjo(jo,"production_dispatch_accomplish")
        isViewStatementAccountPhoto = JsonUtil.getisjo(jo,"view statement_account_photo")
        isEditStatementAccountPhoto = JsonUtil.getisjo(jo,"edit statement_account_photo")
        isViewOemOrder = JsonUtil.getisjo(jo,"view oem_order")
        isEditViewOemOrder = JsonUtil.getisjo(jo,"edit oem_order deliver_voucher")
        isPrintYuliaoLabel = JsonUtil.getisjo(jo,"print yuliao_label")
        isViewYuliaoFreightSpace = JsonUtil.getisjo(jo,"view yuliao_freight_space")
        isEditYuliaoFreightSpace = JsonUtil.getisjo(jo,"edit yuliao_freight_space")
        isViewYuliaoFreightSpaceGi = JsonUtil.getisjo(jo,"view yuliao_freight_space_gi")
        isEditYuliaoFreightSpaceGi = JsonUtil.getisjo(jo,"edit yuliao_freight_space_gi")
        isConsigneeMaterialQuality = JsonUtil.getisjo(jo,"consignee material_quality")
        isGatherPieceworkColl = JsonUtil.getisjo(jo,"gather piecework coll")
        isdeliver = JsonUtil.getisjo(jo,"deliver schedule view")
        isPmcPcode = JsonUtil.getisjo(jo, "load_material stores_requisition")
        isPMCDuiHao = JsonUtil.getisjo(jo, "view duihao")
        isCreateStoresRequisition = JsonUtil.getisjo(jo, "create storesRequisition package")
    }
    fun baocun(editor :  SharedPreferences.Editor){
        editor.putBoolean("iscrm", iscrm);
        editor.putBoolean("isscdd", isscdd);
        editor.putBoolean("isgonggao", isgonggao);
        editor.putBoolean("isdanju", isdanju);
        editor.putBoolean("isjijian", isjijian);
        editor.putBoolean("isdeletedanju", isdeletedanju);
        editor.putBoolean("ischakandanju", ischakandanju);
        editor.putBoolean("isvieworder", isvieworder);
        editor.putBoolean("isviewquality", isviewquality);
        editor.putBoolean("iseditquality", iseditquality);
        editor.putBoolean("iseditorder", iseditorder);
        editor.putBoolean("ischakanjiehao", ischakanjiehao);
        editor.putBoolean("isfenpeijiehao", isfenpeijiehao);
        editor.putBoolean("isfenpeisuoyoujiehao", isfenpeisuoyoujiehao);
        editor.putBoolean("isquxiaofenpeijiehao", isquxiaofenpeijiehao);
        editor.putBoolean("isquanmingjiehao", isquanmingjiehao);
        editor.putBoolean("isChaKanZhiXiangFenPei", isChaKanZhiXiangFenPei);
        editor.putBoolean("isBianJiZhiXiang", isBianJiZhiXiang);
        editor.putBoolean("isFenPeiZhiXiang", isFenPeiZhiXiang);
        editor.putBoolean("isXingKaiZhuanMaiDian",isXingKaiZhuanMaiDian);
        editor.putBoolean("isBianJiZhuanMaiDian",isBianJiZhuanMaiDian);
        editor.putBoolean("isFenPeiSuoYouZhiXiang", isFenPeiSuoYouZhiXiang);
        editor.putBoolean("isQuXiaoFenPeiZhiXiang", isQuXiaoFenPeiZhiXiang);

        editor.putBoolean("isAnZhuangZhiNan", isAnZhuangZhiNan);
        editor.putBoolean("isSheJiZhiNan", isSheJiZhiNan);

        editor.putBoolean("isShuangChuanAnZhuang", isShuangChuanAnZhuang);

        editor.putBoolean("isChaKanWuLiaoZhiLiang",isChaKanWuLiaoZhiLiang);
        editor.putBoolean("isXiuGaiWuLiaoZhiLiang",isXiuGaiWuLiaoZhiLiang);
        editor.putBoolean("isDeleteWuLiaoZhiLiang",isDeleteWuLiaoZhiLiang);
        editor.putBoolean("isXiuGaiWuLiaoZhiLiangT",isXiuGaiWuLiaoZhiLiangT);

        editor.putBoolean("isChaKanTouSuJianYi",isChaKanTouSuJianYi);
        editor.putBoolean("isXiuGaiTouSuJianYi",isXiuGaiTouSuJianYi);

        editor.putBoolean("isJiJianCaiJi",isJiJianCaiJi);
        editor.putBoolean("isLvRuJiJianCaiJi",isLvRuJiJianCaiJi);
        editor.putBoolean("isdeliver",isdeliver);


        editor.commit()
    }
}
